package tmall.framework.exception;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author jing.tong
 * @version 1.0.0
 * @description
 * @createTime 2022年01月16日 13:02:00
 */
@Getter
@Setter
@ToString
public class TException extends RuntimeException{
    private String msg;
    private String code ;
    private Object[] args;

    public TException() {
        super();
    }

    public TException(String msg) {
        this(FrameworkExceptionDict.CUSTOM_EXCEPTION,new Object[]{msg});
    }

    public TException(ErrorEnum errorEnum) {
        super(errorEnum.getMsg());
        this.msg = errorEnum.getMsg();
        this.code = errorEnum.getCode();
    }

    public TException(ErrorEnum errorEnum,Object[] args) {
        super(errorEnum.getMsg());
        this.msg = errorEnum.getMsg();
        this.code = errorEnum.getCode();
        this.args = args;
    }
    public TException(ErrorEnum errorEnum, Throwable cause) {
        super(errorEnum.getMsg(), cause);
        this.msg = errorEnum.getMsg();
        this.code = errorEnum.getCode();
    }

}
